<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <ul id="parent">
        <li>1</li>
        <li>2</li>
        <li>3</li>
    </ul>
    <script>
    /* childNodes-->所有类型的子节点 
     children-->只获取元素子节点
    */
     var childs=document.getElementById("parent").childNodes;
     var childEle=document.getElementById("parent").children;
     for(var i=0;i<childs.length;i++){
         if(childs[i].nodeType==1){
             childs[i].style.color="red";
         }
     }
     console.log(childs.length);
    </script>
</body>
</html>